function Platform(x, y, type){
//	function takes position and platform type

	this.width = 70,
	this.height = 20;
	this.firstColor = '#FF8C00';
	this.secondColor = '#EEEE00';
	this.bounceSpeed = 17;
	if(type == 1){
		this.firstColor = '#AADD00';
		this.secondColor = '#698B22';
		this.bounceSpeed = 30;
	}
	
	this.x = Math.floor(x);
	this.y = Math.floor(y);
	
	this.onCollide = function(){
		player.fallStop();
	};
	this.draw = function(ctx){
		ctx.fillStyle = 'rgba(255, 255, 255, 1)';
		var gradient = ctx.createRadialGradient(this.x + (this.width/2), this.y + (this.height/2), 5, this.x + (this.width/2), this.y + (this.height/2), 45);
		//createRadialGradient(x1, y1, r1, x2, y2, r2);
		gradient.addColorStop(0, this.firstColor);
		gradient.addColorStop(1, this.secondColor);
		ctx.fillStyle = gradient;
		ctx.fillRect(this.x, this.y, this.width, this.height);
//		drawing gradient inside rectangular platform
	};

	this.checkCollisionWithPlayer = function(player){
		//if any part of player box is over platform and bottom edge of player intersects platform area
		if ( player.speed < 0 && 
				player.x < this.x + this.width && 
				player.x +player.width > this.x &&
				player.y + player.height > this.y && 
				player.y + player.height < this.y + this.height){
			player.speed=this.bounceSpeed;
		}
	};
};

